home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / DB_CLIPP / 0643B.ZIP / SAY2FILE.DOC < prev    next >
Text File  |  1987-04-17  |  3KB  |  82 lines

  1. *** SAY2FILE.ASM
  2. Say2file.ASM            (May p. 3, dBASE III PLUS)
  3.  
  4. Say2File is an assembly language program that redirects printer output to
  5. a text file, allowing you to send @...SAY's to a disk file rather than to
  6. the printer.  Normally, dBASE III PLUS sends printer output through a
  7. printer file handle, namely the printer specified by the SET PRINTER TO
  8. command.  Say2File forces DOS to write to a different file handle, the
  9. file you specify.  It does not change the operation of dBASE III PLUS in
  10. any way.  It simply redirects output at the DOS level.
  11.  
  12. Before using Say2file, you must LOAD it from within dBASE III PLUS to make
  13. it available to your programs.  To do this, execute the command:
  14.  
  15.    LOAD Say2file
  16.    
  17. Say2File is called twice in a program: once to create a text file and
  18. redirect the printer output, and another to close the file and restore the
  19. printer output to its default device.  To open a file, send "O" (for
  20. "open") and the text filename as the memory variable parameter:
  21.  
  22.    mvar = "O<filespec>"
  23.    CALL Say2File WITH mvar
  24.       
  25. where <filespec> is the text filename, including the drive and path if
  26. necessary.  If you do not specify a file extension, the file Say2file
  27. creates will not have one.
  28.  
  29. To now direct output to the disk file you've specified, just give the
  30. command SET DEVICE TO PRINT as if you were printing to the printer.  All
  31. output generated by @...SAY's will go to the specified disk file.
  32.  
  33. To close the text file and restore the default print device, use this
  34. command syntax:
  35.  
  36.    mvar = "C"
  37.    CALL Say2File WITH mvar
  38.  
  39. The parameters you send must be memory variables since Say2file returns
  40. DOS error codes and needs a place to return them.  If there are no errors,
  41. Say2file returns a space as the first character of the return memory
  42. variable.  Otherwise, the first character is one of the following error
  43. codes:
  44.  
  45.  
  46. Error Code  Description                                         
  47. ==========  =====================================================
  48. Space       No error occurred.
  49.  
  50. A           Activity error.  Occurs when the output file is open
  51.             and you CALL Say2File to open it again.  It also
  52.             occurs when the output file is closed and you CALL
  53.             Say2File to close it.
  54.  
  55. C           Close error.  DOS cannot close the output file.
  56.  
  57. D           DOS cannot duplicate the printer file handle.  Could
  58.             be caused by too many files open.   
  59.  
  60. O           Open error.  DOS cannot open the text file.  Could be
  61.             caused by too many files open, an invalid filename,
  62.             or attempting to write to a read-only file or
  63.             directory. 
  64.  
  65. R           DOS cannot perform the redirection.  
  66.  
  67. S           Syntax error.  The parameter being passed is not
  68.             structured correctly.  It can occur when you
  69.             send an empty string as the parameter.
  70.  
  71. Though Say2file.BIN is included on this diskette, you may wish to assemble
  72. it yourself.  To assemble Say2File.ASM to a .BIN file, the following files
  73. must be available, either in the same subdirectory as Say2File.ASM or
  74. through the DOS PATH command: MASM.EXE, LINK.EXE, and EXE2BIN.EXE.  Follow
  75. the steps below to assemble Say2File.ASM as a .BIN file:
  76.  
  77.       MASM Say2File.ASM;    
  78.       LINK SAY2FILE;
  79.       EXE2BIN SAY2FILE
  80.       ERASE SAY2FILE.EXE 
  81.       ERASE SAY2FILE.OBJ
  82.